package com.example.tys.baseapplication.DataModel.greendao;

import com.example.tys.baseapplication.DataModel.data.AbstractDataFactory;
import com.example.tys.baseapplication.DataModel.data.DataServer;
import com.example.tys.baseapplication.DataModel.data.IDaoOperation;
import com.example.tys.baseapplication.DataModel.greendao.gen.UserDao;
import com.example.tys.baseapplication.MyApp;
import com.example.tys.baseapplication.bean.User;

import org.greenrobot.greendao.AbstractDao;

import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;

/**
 * @author tys
 * @date 2017/9/30
 */

public class GreenDaoFactory extends AbstractDataFactory {
    @Override
    protected <T> IDaoOperation<?> getDaoOperation(Class<T> dataType) {
        //类型 对应的表
        if (dataType.getName().equals(User.class.getName())) {
            UserDao dao = MyApp.getInstance().getDaoSession().getUserDao();
            return new UserDaoOperation(dao);
        }/*else if(dataType.getName().equals(xxxxx)) {

        }*/ else {
            //not register
            return null;
        }
    }

}